//
//  LSZHelpResponsiblePersonVC.m
//  PartyClassCloud
//
//  Created by 梁素珍 on 2018/11/30.
//  Copyright © 2018年 九酷. All rights reserved.
//

#import "LSZHelpResponsiblePersonVC.h"

@interface LSZHelpResponsiblePersonVC ()<UITableViewDataSource,UITableViewDelegate>
@property(nonatomic,strong) UITableView * helpResponsibleTableView;
@property(nonatomic,strong) NSArray* arrayTitleArray;
@property(nonatomic,strong) NSDictionary * dicTionData;
@end

@implementation LSZHelpResponsiblePersonVC

- (void)viewDidLoad {
    [super viewDidLoad];
    self.title = @"帮扶责任人";
    self.arrayTitleArray = @[@"姓名",@"单位名称",@"隶属关系",@"联系电话",@"开始时间",@"结束时间"];
    [self getDataDic];
    [self.helpResponsibleTableView registerNib:[UINib nibWithNibName:@"LSZOrSoTableViewCell" bundle:nil] forCellReuseIdentifier:@"LSZOrSoTableViewCell"];
}
-(void)getDataDic
{
    [LSZRequestData helpTheResponsiblePerson:self.householdNumber :^(BOOL isOk, NSString * string, NSDictionary * dic) {
        if (isOk == YES) {
            self.dicTionData = dic;
            [self.helpResponsibleTableView reloadData];
        }else{
            if ([string isEqualToString:@"重复登录"]) {
                [LSZPublicClassDataToll RepeatLoginInterfaceJump:self.view fromVC:@"LSZLiteratureViewController"];
            }else{
                [LSZPublicClassDataToll initWithAlertKuangView:self.view string:string];
            }
        }
    }];
}
- (NSInteger)tableView:(nonnull UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
    return self.arrayTitleArray.count;
}
-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
    return 45;
}
-(CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section
{
    return 0.001;
}
-(CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section
{
    return 0.001;
}
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    LSZOrSoTableViewCell * cell = [tableView dequeueReusableCellWithIdentifier:@"LSZOrSoTableViewCell" forIndexPath:indexPath];
    cell.leftLabel.text = self.arrayTitleArray[indexPath.row];
    switch (indexPath.row) {
        case 0:
            {
                cell.rightBut.text = [NSString stringWithFormat:@"%@",self.dicTionData[@"name"]];
            }
            break;
        case 1:
        {
            cell.rightBut.text = NullStringjudgment(NSStr(self.dicTionData[@"position"]));
        }
            break;
        case 2:
        {
            cell.rightBut.text = [NSString stringWithFormat:@"%@",self.dicTionData[@"jobLabel"]];
        }
            break;
        case 3:
        {
            cell.rightBut.text = [NSString stringWithFormat:@"%@",self.dicTionData[@"contactPhone"]];
        }
            break;
        case 4:
        {
            cell.rightBut.text = [NSString stringWithFormat:@"%@",self.dicTionData[@"registerTime"]];
        }
            break;
        case 5:
        {
            cell.rightBut.text = [NSString stringWithFormat:@"%@",self.dicTionData[@"loginTime"]];
        }
            break;
        default:
            break;
    }
    cell.selectionStyle = UITableViewCellSelectionStyleNone;
    return cell;
}
-(UITableView *)helpResponsibleTableView
{
    if (_helpResponsibleTableView == nil) {
        _helpResponsibleTableView = [[UITableView alloc]initWithFrame:CGRectMake(0, 0, [[UIScreen mainScreen] bounds].size.width , [[UIScreen mainScreen] bounds].size.height) style:UITableViewStyleGrouped];
        _helpResponsibleTableView.delegate = self;
        _helpResponsibleTableView.dataSource = self;
        _helpResponsibleTableView.estimatedRowHeight=0;
        _helpResponsibleTableView.estimatedSectionFooterHeight =0;
        _helpResponsibleTableView.estimatedSectionHeaderHeight =0;
        [_helpResponsibleTableView setSeparatorInset:UIEdgeInsetsMake(0, 20, 0, 20)];
        [self.view addSubview:_helpResponsibleTableView];
    }
    return _helpResponsibleTableView;
}
@end
